import { EMClient } from '@/easemob'
import {showToast} from 'vant'
export const emConnectListener = () => {
  // 连接监听
  console.log('注册连接监听')
 EMClient.addEventHandler('connect',{
  onConnected:()=>{
    console.log('连接成功')
    showToast('IM 连接成功')
  },
  onDisconnected:()=>{
    console.log('连接断开')
    showToast('IM 断开')
  },
  onError:()=>{
    console.log('连接错误')
  },
  onReconnecting:()=>{
    console.log('重连中')
    showToast('IM 重连中')
  },
  onTokenExpired:()=>{
    console.log('token过期')
  },
  onTokenWillExpire:()=>{
    console.log('token即将过期')
  },
  onOffline:()=>{
    console.log('网络离线')
  },
  onOnline:()=>{
    console.log('网路上线')
  }
 })
}
